var app=angular.module('myApp', []).
  config(['$routeProvider', function($routeProvider) {
  $routeProvider.
      when('/', {templateUrl: 'report_outstanding.html', controller: ListExpMstCtrl}).      
      when('/cancel/', {templateUrl: 'report_outstanding.html', controller: ListExpMstCtrl}). 
      otherwise({redirectTo: '/'});
}]);


function ListExpMstCtrl($scope, $http,$window,$location,$filter)
 {
 
    $scope.currentPage = 0;
    $scope.pageSize = 25;
	$scope.Math = window.Math;
	$scope.ed = false;
	$scope.soc_inp = [];
	$scope.soc_arr = [];
	$scope.cust_arr = [];
	$scope.searchname ='';
	
    $http.get('report_outstanding_data.php').success(function(data) {	
		$scope.outmast = data;
		for(var i=0; i<data.length;i++){
			$scope.soc_inp[i] = data[i].sname;			
			$scope.cust_arr[i] = data[i].cname;
		}
		$scope.soc_arr = jQuery.unique( $scope.soc_inp );
		$scope.soc_arr.sort();
		$scope.cust_arr.sort();
    });    	  	
	
	//Function to Clear     
    $scope.cancel= function()
	{
		$scope.activePath = null;
		$scope.activePath = $location.path('report_outstanding.php');
	};  
 }//end scope
    
    //Custom Filter Function to sort the record.
    app.filter('startingFrom', function() 
    {
        return function(input, start) 
        {
            start = +start; //parse to int
            return input.slice(start);
        };
    });
	
	
		